using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text;
using System.Data; 
using yq.IBase; 
using yq.Dictionary; 
using yq.Basis; 
using yq.Model.Logic;
using System.Collections; 
using Db; 
using System.Data.Common;

namespace yq.Model.Base 
{
    ///<summary>
    /// Flie_Purview - 文件权限 - 对象基础类
    /// </summary>
    ///<typeparam name="T"></typeparam>
    public abstract class IFliePurview<T> :ModelBase<FilePurview> where T : FilePurview, new()
    {
        /// <summary>
        /// 写入主键值
        /// </summary>
        /// <param name="Id">主键</param>
        protected internal override void SetKeyValue(dynamic Id)
        {
            this.FliePwId = Id;
        }

        /// <summary>
        /// 获取主键值
        /// </summary>
        /// <returns></returns>
        protected internal override dynamic GetKeyValue()
        {
            return FliePwId;
        }

        /// <summary>
        /// 为本对象赋值
        /// </summary>
        /// <param name="dy"></param>
        public override void SetValue(dynamic dy) 
        {
           this.FliePwId=dy.FliePwId;
           this.FileId=dy.FileId;
           this.ModelsId=dy.ModelsId;
           this.Type=dy.Type;
           this.PurviewLevel=dy.PurviewLevel;
        } 

        #region 定义属性

     
         /// <summary>
        /// 文件权限信息
        /// </summary>
        private String _FliePwId = "";
      
        /// <summary>
        /// 文件权限信息
        /// </summary>
        public String FliePwId
        {
            get 
            {
              return   (this._FliePwId); 
            }

            set 
            {
                    _FliePwId= value;  
            }
        }
       
     
         /// <summary>
        /// 文件Id
        /// </summary>
        private String _FileId = "";
      
        /// <summary>
        /// 文件Id
        /// </summary>
        public String FileId
        {
            get 
            {
              return   (this._FileId); 
            }

            set 
            {
                    _FileId= value;  
            }
        }
       
     
         /// <summary>
        /// 获取权限的团队或者个人Id
        /// </summary>
        private String _ModelsId = "";
      
        /// <summary>
        /// 获取权限的团队或者个人Id
        /// </summary>
        public String ModelsId
        {
            get 
            {
              return   (this._ModelsId); 
            }

            set 
            {
                    _ModelsId= value;  
            }
        }
       
     
         /// <summary>
        /// 类别
        /// </summary>
        private int _Type =-1;
      
        /// <summary>
        /// 类别
        /// </summary>
        public yq.Enums.FliePurview.Type Type
        {
            get 
            {
              return   (yq.Enums.FliePurview.Type)this._Type;  
            }

            set 
            {
                    _Type= value.GetHashCode(); 
            }
        }
       
     
         /// <summary>
        /// 授权级别
        /// </summary>
        private int _PurviewLevel =-1;
      
        /// <summary>
        /// 授权级别
        /// </summary>
        public yq.Enums.FliePurview.PurviewLevel PurviewLevel
        {
            get 
            {
              return   (yq.Enums.FliePurview.PurviewLevel)this._PurviewLevel;  
            }

            set 
            {
                    _PurviewLevel= value.GetHashCode(); 
            }
        }
       

      #endregion 定义属性 

          protected internal override void SetValue(FilePurview info, DataRow row) 
          { 
               if (row == null) 
               { 
                 info.IsLoad = false; 
               }
               else 
               { 
                  info.IsLoad = true; 
                  
                  if(row["FliePwId"]!= DBNull.Value)
                  {
                  info.FliePwId=row["FliePwId"].ToString();
                 }
                 
                  
                  if(row["FileId"]!= DBNull.Value)
                  {
                  info.FileId=row["FileId"].ToString();
                 }
                 
                  
                  if(row["ModelsId"]!= DBNull.Value)
                  {
                  info.ModelsId=row["ModelsId"].ToString();
                 }
                 
                  
                  if(row["Type"]!= DBNull.Value)
                  {
                  info.Type=  (yq.Enums.FliePurview.Type)(row["Type"]) ;
                 }
                 
                  
                  if(row["PurviewLevel"]!= DBNull.Value)
                  {
                  info.PurviewLevel=  (yq.Enums.FliePurview.PurviewLevel)(row["PurviewLevel"]) ;
                 }
                 
               } 

          } 

        protected internal override void GetDbParameters(DbCommand comm, FilePurview info, DbHelper cn) 
        { 
             
                cn.AddInParameter(comm, "@FliePwId", DbType.String,ParameterTool.GetObj( info._FliePwId )); 
            
             
                cn.AddInParameter(comm, "@FileId", DbType.String,ParameterTool.GetObj( info._FileId )); 
            
             
                cn.AddInParameter(comm, "@ModelsId", DbType.String,ParameterTool.GetObj( info._ModelsId )); 
            
             
                cn.AddInParameter(comm, "@Type", DbType.Int32,ParameterTool.GetObj( info._Type )); 
            
             
                cn.AddInParameter(comm, "@PurviewLevel", DbType.Int32,ParameterTool.GetObj( info._PurviewLevel )); 
            
        } 

    } 
} 